import jdk.internal.org.objectweb.asm.tree.MultiANewArrayInsnNode;

import java.util.Stack;

public class Test {
        public static void main(String[] args) {
                BinaryTree binaryTree = new BinaryTree();
                BinaryTree.TreeNode root = binaryTree.createTree();
                //前序遍历
                binaryTree.perOrder(root);
                System.out.println();
                //前序遍历（非递归）
                binaryTree.perOrderNor(root);
                System.out.println();
                //中序遍历
                binaryTree.inOrder(root);
                System.out.println();
                binaryTree.inOrderNor(root);
                System.out.println();
                //后续遍历
                binaryTree.postOrder(root);
                System.out.println();
                binaryTree.postOrderNor(root);
                System.out.println();

                //结点的个数
                //System.out.println(binaryTree.size(root));
                binaryTree.size(root);
                System.out.println(BinaryTree.usedSide);

                System.out.println(binaryTree.getTreeNodeCount1(root));
        //        binaryTree.getTreeNodeCount(root);
        //        System.out.println(BinaryTree.leafSize);

                System.out.println("叶子结点的个数");
                System.out.println(binaryTree.getTreeNodeCount1(root));

                System.out.println("第k层结点的个数");
                System.out.println(binaryTree.getKLevelNodeCount(root,4));

                System.out.println("树的深度");
                System.out.println(binaryTree.maxDepth(root));

                System.out.println("查找");
                BinaryTree.TreeNode ret = binaryTree.find(root,'E');
                System.out.println(ret.val);

                System.out.println("层序遍历");
                binaryTree.levelOrder(root);
                System.out.println();

                System.out.println("是否为完全二叉树");
                System.out.println(binaryTree.isCompleteTree(root));
                System.out.println();

                System.out.println("获取路径");
                Stack<BinaryTree.TreeNode> stack = new Stack<>();
                System.out.println(binaryTree.getPath(root, root.left.right, stack));
        }

}
